//
// Created on 2024/10/23.
//
// Node APIs are not fully supported. To solve the compilation error of the interface cannot be found,
// please include "napi/native_api.h".

#ifndef LALVLC_OHAUDIO_H
#define LALVLC_OHAUDIO_H

#include "napi/native_api.h"
#include <ohaudio/native_audiorenderer.h>
#include <ohaudio/native_audiostreambuilder.h>
#include <sys/stat.h>
#include <string>
#include "hilog/log.h"
#undef LOG_TAG
#define LOG_TAG "vidioPlayer"

class Lal0haudio{
public:
     Lal0haudio();
    ~Lal0haudio();
    static int32_t AudioRendererOnWriteData(OH_AudioRenderer *renderer, void *userData, void *buffer, int32_t bufferLen);
    int GetRendererState();
    int AudioRendererInit(bool  LowLatency);
    int64_t GetFramesWritten();
    int32_t AudioRendererStart();
    int32_t AudioRendererPause();
    int32_t AudioRendererStop();
    int32_t AudioRendererRelease();
    int32_t Update();
private:   
     static FILE *file;
     OH_AudioRenderer *audioRenderer;
     OH_AudioStreamBuilder *rendererBuilder;
     std::string filePath ;
     int32_t samplingRate;
     int32_t channelCount;
     bool readEnd;
     bool rendererLowLatency;
};

#endif //LALVLC_OHAUDIO_H
